package cn.shyouchi.wuguanjia.android.ui.patrol.selline;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;
import cn.shyouchi.wuguanjia.android.impl.ModuleItemClickListener;
import cn.shyouchi.wuguanjia.android.ui.event.checknum.CheckNumLineEntity;

/**
 * Created by Eenie on 2016/12/28 at 9:15
 * Email: 472279981@qq.com
 * Des:
 */

public class PatrolLineAdapter extends BaseQuickAdapter<CheckNumLineEntity.ResultMessageBean,BaseViewHolder> {

    ModuleItemClickListener mItemClickListener;

    public PatrolLineAdapter( List<CheckNumLineEntity.ResultMessageBean> data,ModuleItemClickListener listener) {
        super(R.layout.item_patrol_sel_line_layout, data);
        this.mItemClickListener = listener;
    }

    @Override
    protected void convert(BaseViewHolder holder, final CheckNumLineEntity.ResultMessageBean entity) {

        holder.setText(R.id.tv_position, String.valueOf(holder.getAdapterPosition() + 1));
        holder.setText(R.id.tv_line_name, entity.getName());


        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mItemClickListener.moduleItemClick(entity);
            }
        });
    }
}
